package com.leeon.container.stack;

import java.util.LinkedList;

import static net.mindview.util.Print.print;

public class MyStack<T> {

    private LinkedList<T> storage = new LinkedList<T>();

    public void push(T t){
        storage.push(t);
    }

    public T peek(){
        return storage.peek();
    }

    public T pop(){
        return storage.pop();
    }

    public boolean empty(){
        return storage.isEmpty();
    }

    @Override
    public String toString() {
        return storage.toString();
    }

    public static void main(String[] args){
        MyStack<String> myStack = new MyStack<String>();

        for (String s: "My dog has fleas".split(" ")){
            myStack.push(s);
        }

        while (!myStack.empty()){
            print(myStack.pop());
        }
    }
}
